package com.aaa.base.service.impl;

import com.aaa.base.mapper.SupplierMapper;
import com.aaa.base.service.SupplierService;
import com.aaa.entity.base.Supplier;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author aaa
 * @since 2020-11-23
 */
@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements SupplierService {



    @Override
    public Page<Supplier> searchSupplier(Integer page, Integer limit, Supplier supplier) {
        Page<Supplier> pageinfo=new Page<>(page,limit);
        String name=supplier.getName();
        QueryWrapper<Supplier> queryWrapper=new QueryWrapper<>();
        if(StringUtils.isNotEmpty(name)){
            queryWrapper.like("name",name);
        }
        this.baseMapper.selectPage(pageinfo, queryWrapper);
        return pageinfo;
    }
}
